package com.shruijin.wy.aop.advice;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * method 1： 利用spring aop 方式，在 xml 中配置 aspect
 */
public class ActionAdvice {

    Logger LOGGER = LoggerFactory.getLogger(this.getClass());

    public void before(JoinPoint joinPoint){
        LOGGER.info("{} 前置通知!",joinPoint.getSignature().getName());
    }

    public void after(JoinPoint joinPoint){
        LOGGER.info("{} 后置通知!",joinPoint.getSignature().getName());
    }

    public void arround(ProceedingJoinPoint joinPoint) throws Throwable {
        LOGGER.info("{} 环置通知!",joinPoint.getSignature().getName());
        joinPoint.proceed();
    }

    public void afterreturn(JoinPoint joinPoint){
        LOGGER.info("{} 返回通知!",joinPoint.getSignature().getName());
    }

    public void afterthrown(JoinPoint joinPoint){
        LOGGER.info("{} 异常通知!",joinPoint.getSignature().getName());
    }

}
